package com.kayt.cyberBar.cpublic.business.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kayt.cyberBar.common.PageData;
import com.kayt.cyberBar.common.ServerResponse;
import com.kayt.cyberBar.cpublic.business.entity.po.CPublicRole;
import com.kayt.cyberBar.cpublic.business.entity.req.vo.PublicRoleReqVO;
import com.kayt.cyberBar.cpublic.business.entity.rsp.vo.PublicRoleRspVO;
import com.kayt.cyberBar.cpublic.business.server.IPublicRoleServer;
import com.kayt.cyberBar.cpublic.business.service.IPublicRoleService;

@Service("publicRoleService")
public class PublicRoleServiceImpl implements IPublicRoleService{
	
	@Autowired
	private IPublicRoleServer publicRoleServer;
	@Override
	public ServerResponse<PageData<PublicRoleRspVO>> getRoleList() {
		PageData<CPublicRole> rolePageData = publicRoleServer.get_role_list();
		return publicRoleServer.assemble_result_list(rolePageData);
	}
 
	@Override
	public ServerResponse<PublicRoleRspVO> addRole(PublicRoleReqVO roleReqVO) {
		CPublicRole role = publicRoleServer.add_Role(roleReqVO);
		return publicRoleServer.assemble_result(role);
	}

	@Override
	public ServerResponse<PublicRoleRspVO> updateRole(PublicRoleReqVO roleReqVO) {
		CPublicRole role = publicRoleServer.mod_role(roleReqVO);
		return publicRoleServer.assemble_result(role);
	}

	@Override
	public ServerResponse<String> deleteRole(String roleId) {
		Integer result = publicRoleServer.del_role(roleId);
		return publicRoleServer.assemble_result_string(result);
	}

}
